package tree;


import javax.swing.*;
import java.awt.*;
import java.io.IOException;

public class Main {
    static JFrame jf;
    static JPanel jpanel;
    static JTextArea jta = null;
    static JScrollPane jscrollPane;
    public void tree() throws IOException {
        jf = new JFrame("");
        Container contentPane = jf.getContentPane();
        contentPane.setLayout(new BorderLayout());
        jta = new JTextArea(100, 150);
        jta.setTabSize(4);
        jta.setFont(new Font("标楷体", Font.BOLD, 16));
        jta.setLineWrap(true);// 激活自动换行功能
        jta.setWrapStyleWord(true);// 激活断行不断字功能
//        jta.setBackground();
        jscrollPane = new JScrollPane(jta);
        jpanel = new JPanel();
        jpanel.setLayout(new GridLayout(1, 3));
        contentPane.add(jscrollPane, BorderLayout.CENTER);
        contentPane.add(jpanel, BorderLayout.SOUTH);
        jf.setSize(1000, 1000);
        jf.setLocation(400, 20);
        jf.setVisible(true);

        Parser par = new Parser();
        Node root;
        root=par.parseTree();
        String s = root.treePrint();
        System.out.println(s);
        jta.append(s);

    }
}
